package com.westar.base.businessUtil;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.westar.base.cons.Constant;
import com.westar.base.emum.PublicServiceEnum;
import com.westar.base.model.*;
import com.westar.core.conf.SysConst;
import com.westar.base.exceptions.LoginException;
import com.westar.base.pojo.PageBean;
import com.westar.base.pojo.WestarResult;
import com.westar.base.util.WestarHttpUtil;
import org.apache.commons.lang3.StringUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static com.westar.base.enums.HTTPResultEnum.RESPONEBODY;

public class ImplementPageUtil {

    private static Logger logger = LoggerFactory.getLogger( ImplementPageUtil.class);
    /**
     * 取得所有区域数据信息
     * @param actCookie
     * @return
     * @throws IOException
     * @throws LoginException
     */
    public static List<Implement> queryAllImplement(String actCookie) throws IOException {
        List<Implement> implementList = new ArrayList<>();

        String url = "http://"+ SysConst.DOMAIN+"/directoryLevel/queryTreeImplement";

        Map<String,String> searchForm = new HashMap<>( );

        String responeBody = WestarHttpUtil.postMethod( url,actCookie,searchForm);
        JSONArray rows = JSONArray.parseArray( responeBody);
        if(null != rows && !rows.isEmpty()){
            for (Object data :rows){
                JSONObject implementJson = JSONObject.parseObject(data.toString());

                Implement implement = new Implement();
                implement.setImplementId(implementJson.getString( "id" )  );
                implement.setName(implementJson.getString( "name" ));
                implement.setParentId(implementJson.getInteger( "parentId"));
                implement.setCode(implementJson.getString( "code"));

                implementList.add(implement);

                String state = implementJson.getString( "state");
                if(state.equals( "closed" )){
                    List<Implement> areaSubList = ImplementPageUtil.getImplementFromPage(url,actCookie,implement.getImplementId());
                    implementList.addAll(areaSubList);
                }
            }
        }

        return implementList;
    }


    private static List<Implement> getImplementFromPage(String url, String actCookie, String parentId)
            throws IOException {
        List<Implement> implementList = new ArrayList<>();
        Map<String,String> searchForm = new HashMap<>( );
        searchForm.put( "id",parentId);

        String responeBody = WestarHttpUtil.postMethod( url,actCookie,searchForm);
        JSONArray rows = JSONArray.parseArray( responeBody);
        if(null != rows && !rows.isEmpty()){
            for (Object data :rows){
                JSONObject implementJson = JSONObject.parseObject(data.toString());

                Implement implement = new Implement();
                implement.setImplementId(implementJson.getString( "id" )  );
                implement.setName(implementJson.getString( "name" ));
                implement.setParentId(implementJson.getInteger( "parentId"));
                implement.setCode(implementJson.getString( "code"));

                implementList.add(implement);

                String state = implementJson.getString( "state");
                if(state.equals( "closed" )){
                    List<Implement> areaSubList = ImplementPageUtil.getImplementFromPage(url,actCookie,implement.getImplementId());
                    implementList.addAll(areaSubList);
                }

            }
        }
        return implementList;
    }
    /**
     * 获取事项详情
     * @param actCookie
     * @return
     */
    public static PageBean<ImplementDetail> queryAllImplementDetail(String actCookie,Integer page,Integer rows
            ,ImplementDetail implementDetail,String isNotPublicServices)
            throws IOException {

        String areaCodes = implementDetail.getAreaCode();
        String showEventCode = implementDetail.getShowEventCode();
        String eventName = implementDetail.getEventName();
        String deptCodes = implementDetail.getDeptCodes();

        if(StringUtils.isEmpty(isNotPublicServices)){
            isNotPublicServices = PublicServiceEnum.POWER.getParam();
        }

        PageBean<ImplementDetail> implementList = new PageBean<ImplementDetail>();

        String url = "http://"+ SysConst.DOMAIN+"/thingsui/implementList/queryList?isNotPublicServices="+isNotPublicServices;
        Map<String,String> searchForm = new HashMap<>( );
        searchForm.put( "page",page.toString() );
        searchForm.put( "rows",rows.toString() );

        if(StringUtils.isNotEmpty(areaCodes)){
            searchForm.put( "areaCodes",areaCodes);
        }else{
            searchForm.put( "areaCodes","");
        }
        searchForm.put( "majorTerm","");
        searchForm.put( "majorTermName","");
        searchForm.put( "areaCode","");
        searchForm.put( "deptIds","");

        if(StringUtils.isNotEmpty(eventName)){
            searchForm.put( "eventName",eventName);
        }else{
            searchForm.put( "eventName","");
        }
        if(StringUtils.isNotEmpty(showEventCode)){
            searchForm.put( "showEventCode",showEventCode);
        }else{
            searchForm.put( "showEventCode","");
        }
        searchForm.put( "trade","");
        searchForm.put( "eventCode","");

        if(StringUtils.isNotEmpty(deptCodes)){
            searchForm.put( "deptCodes",deptCodes);
        }else{
            searchForm.put( "deptCodes","");
        }

        Map<String,String> result = WestarHttpUtil.postMethodForAllAndFull( url,actCookie,searchForm);

        String responeBody = result.get(RESPONEBODY.toString());

        JSONObject res = JSONObject.parseObject(responeBody);

        implementList.setTotalCount(0);
        if(null != res){
            Integer total = res.getInteger("total");
            implementList.setTotalCount(total);
            if(total > 0){
                List<ImplementDetail> recordList = ImplementPageUtil.getImplementDetailPage(res);
                implementList.setRecordList(recordList);
            }
        }else{
            logger.error(url+"，查询数据异常！" + responeBody);
        }

        return implementList;

    }

    private static List<ImplementDetail> getImplementDetailPage(JSONObject res) {
        List<ImplementDetail> implementDetails = new ArrayList<>();
        JSONArray rows = JSONArray.parseArray( res.getString( "rows" ));
        if(null != rows && !rows.isEmpty()){
            for (Object data :rows){
                JSONObject areaJson = JSONObject.parseObject(data.toString());
                ImplementDetail implementDetail = new ImplementDetail();
                //设置源码信息
                implementDetail.setSourceStr(data.toString());

                implementDetail.setImplListId(areaJson.getString( "idForStr" )  );

                String appoveObjects = areaJson.getString( "appoveObject" );
                implementDetail.setAppoveObject(appoveObjects);
                implementDetail.setEventName(areaJson.getString( "eventName"));
                implementDetail.setEnabled(areaJson.getString( "eventStatus"));
                implementDetail.setPromiseTimeLimit(areaJson.getString( "promiseTimeLimit"));
                implementDetail.setLegalTimeLimit(areaJson.getString( "legalTimeLimit"));
                implementDetail.setMajorTerm(areaJson.getString( "majorTerm"));
                implementDetail.setDeptId(areaJson.getString( "deptId"));
                implementDetail.setAreaCode(areaJson.getString( "areaCode"));
                implementDetail.setShowEventCode(areaJson.getString( "showEventCode"));
                implementDetail.setUpdateTime(areaJson.getString( "updateTime"));
                implementDetails.add(implementDetail);
            }
        }
        return implementDetails;
    }

    /**
     * 查询数据信息
     * @param actCookie
     * @param eventName
     * @return
     * @throws IOException
     */
    public static WestarResult queryAllImplementDetailWithMaterial(String actCookie, String eventName,String areaCode,String isNotPublicServices) throws IOException {

        ImplementDetail implementDetailParam = new ImplementDetail();
        implementDetailParam.setEventName(eventName);
        implementDetailParam.setAreaCode(areaCode);
        PageBean<ImplementDetail> pageBean = ImplementPageUtil.queryAllImplementDetail(actCookie,1,100,implementDetailParam,isNotPublicServices);

        Integer pageBeanTotalCount = pageBean.getTotalCount();
        if(pageBeanTotalCount == 1){
            ImplementDetail implementDetail = pageBean.getRecordList().get(0);

            WtaskGeneralBasic wtaskGeneralBasic = ImplementPageUtil.constrWtaskGeneralBasic(implementDetail,actCookie);
            return WestarResult.ok(wtaskGeneralBasic);

        }else if(pageBeanTotalCount < 1){
            return WestarResult.build(-1,"未查询到结果！");
        }else {
            List<ImplementDetail> implementDetail1List = pageBean.getRecordList();

            List<ImplementDetail> actResult = new ArrayList<>();
            for (ImplementDetail implementDetailObj : implementDetail1List) {
                String searchEventName = implementDetailObj.getEventName();
                if(!searchEventName.equals(eventName)){
                    continue;
                }
                String enable = implementDetailObj.getEnabled();
                if(!enable.equals("1")){
                    continue;
                }
                actResult.add(implementDetailObj);
            }
            if(actResult.isEmpty()){
                return WestarResult.build(-1,"未查询到结果！");
            }else if(actResult.size()>1){
                return WestarResult.build(-1,"查询到多条结果！");
            }else{
                ImplementDetail implementDetail = actResult.get(0);
                WtaskGeneralBasic wtaskGeneralBasic = ImplementPageUtil.constrWtaskGeneralBasic(implementDetail,actCookie);
                return WestarResult.ok(wtaskGeneralBasic);
            }
        }
    }

    /**
     * 查询事项对应的材料
     * @param actCookie cookie信息
     * @param implListId 事项主键
     * @return
     * @throws IOException
     */
    public static JSONArray queryMaterialList(String actCookie,String implListId) throws IOException {
        String url = "http://" + SysConst.DOMAIN+"/thingsui/implementList/queryMaterialList";
        Map<String,String> searchForm = new HashMap<>( );
        searchForm.put( "page","1");
        searchForm.put( "rows","50");

        searchForm.put("implListId",implListId);

        JSONArray result = new JSONArray();

        String responeBody = WestarHttpUtil.postMethod(url,actCookie,searchForm);
        if(StringUtils.isNotEmpty(responeBody)){
            Iterator<Map.Entry<String, String>> iterator = searchForm.entrySet().iterator();

            System.out.println("queryMaterialList = > " + responeBody);

            Integer total = JSONObject.parseObject(responeBody).getInteger("total");
            if(total > 0){
                JSONArray rows  = JSONObject.parseObject(responeBody).getJSONArray("rows");
                for (Object obj:  rows) {

                    JSONObject jsonObject = new JSONObject();

                    String materialName = JSONObject.parseObject(obj.toString()).getString("materialName");
                    String idForStr = JSONObject.parseObject(obj.toString()).getString("idForStr");
                    jsonObject.put("materialName",materialName);

                    String materialId = JSONObject.parseObject(obj.toString()).getString("referenceId");
//                            ImplementPageUtil.queryMaterialId(actCookie,idForStr);

                    JSONArray materialItemData = ImplementPageUtil.listMaterialItemData(actCookie,materialId);
                    jsonObject.put("materialItemData",materialItemData);

                    result.add(jsonObject);
                }
            }
        }
        return result;
    }

    public static String viewMaterial(String actCookie, String idForStr)throws IOException {
        String url = "http://"+SysConst.DOMAIN+"/thingsui/implementList/viewMaterial";
        Map<String,String> searchParam = new HashMap<>();
        searchParam.put("id",idForStr);

        String responeBody = WestarHttpUtil.getMethod(url,actCookie,searchParam);
        return responeBody;
    }

//    /**
//     * 获取 materialId
//     * @param actCookie
//     * @param idForStr
//     * @return
//     */
//    public static String queryMaterialId(String actCookie, String idForStr) throws IOException {
//        String materialId = null;
//        String responeBody = ImplementPageUtil.viewMaterial(actCookie,idForStr);
//        Document doc = Jsoup.parse(responeBody);
//        Elements scripts = doc.select("script");
//        for(Element script : scripts) {
//            if (script.html().contains("var referenceId =")) { //注意这里一定是html(), 而不是text()
//
//                String str = script.html().replace("\r\n", ""); //这里是为了解决 无法多行匹配的问题
//
//                //获得参数taskId
//                String regixTask = "var referenceId =\\ (.*?);"; //()必须加，
//                Pattern patternTask = Pattern.compile(regixTask,Pattern.MULTILINE);
//                Matcher matcherTask = patternTask.matcher(str);
//                if(matcherTask.find()){
//                    String option_1 = matcherTask.group();
//                    String referenceId = option_1.replace( "var referenceId = ","" )
//                            .replaceAll( ";","" )
//                            .replaceAll( "\"","" )
//                            .trim();
//
//                    materialId = referenceId;
//                }
//            }
//        }
//
//        return materialId;
//    }

    /**
     * 获取样表附件信息
     * @param actCookie
     * @param materialId
     * @return
     * @throws IOException
     */
    public static JSONArray listMaterialItemData(String actCookie, String materialId) throws IOException {
        String url = "http://"+SysConst.DOMAIN + "/thingsui/materialItem/listData";
        Map<String,String> postParam = new HashMap<>();
        postParam.put("page","1");
        postParam.put("rows","50");
        postParam.put("materialId",materialId);

        String responeBody = WestarHttpUtil.postMethod(url,actCookie,postParam);
        JSONArray result = new JSONArray();
        if(StringUtils.isNotEmpty(responeBody)){
            Integer total = JSONObject.parseObject(responeBody).getInteger("total");
            if(total > 0){
                JSONArray rows  = JSONObject.parseObject(responeBody).getJSONArray("rows");
                for (Object obj:  rows) {
                    JSONObject materialItemData = new JSONObject();

                    String fileName = JSONObject.parseObject(obj.toString()).getString("fileName");
                    String type = JSONObject.parseObject(obj.toString()).getString("type");

                    String attachmentsId = JSONObject.parseObject(obj.toString()).getString("attachmentsId");
                    String fileUrl = "http://"+SysConst.DOMAIN+"/thingsui/attachment/download?id="+attachmentsId;

                    String shardKey = JSONObject.parseObject(obj.toString()).getString("shardKey");
                    if(StringUtils.isNotEmpty(shardKey)){
                        fileUrl = fileUrl+"&shardKey="+shardKey;
                    }
                    materialItemData.put("fileName",fileName);
                    materialItemData.put("fileUrl",fileUrl);
                    materialItemData.put("type",type);
                    result.add(materialItemData);
                }
            }
        }
        return result;
    }

    /**
     * 事项基本
     * @param actCookie 身份识别信息
     * @param idForStr 页面参数主键
     * @param shardKey 页面参数信息
     * @return
     * @throws IOException
     */
    public static String viewImplementBaseDetail(String actCookie,String idForStr,String shardKey) throws IOException {
        String url = "http://"+SysConst.DOMAIN + "/thingsui/implementList/view";
        Map<String,String> postParam = new HashMap<>();
        postParam.put("id",idForStr);
        postParam.put("shardKey",shardKey);

        String responeBody = WestarHttpUtil.getMethod(url,actCookie,postParam);
        return responeBody;

    }



    /**
     * 受理条件查询
     * @param actCookie
     * @param idForStr 事项主键
     * @return
     * @throws IOException
     */
    public static List<String> listImplementBaseAcceptCondition(String actCookie,String idForStr) {
        String url = "http://"+SysConst.DOMAIN + "/thingsui/implementList/queryApprConditonList";
        List<String> list = null;
        try {
            list = ImplementPageUtil.listImplementBaseInfo(actCookie,idForStr,url);
        } catch (IOException e) {
            logger.error( "");
        }
        return list;
    }

    private static List<String> listImplementBaseInfo(String actCookie,String idForStr,String url) throws IOException {
        List<String> list = new ArrayList<String>();

        Integer pageSize = 10;

        Map<String,String> postParam = new HashMap<>();
        postParam.put("implListId",idForStr);
        postParam.put("page","1");
        postParam.put("rows",pageSize.toString());

        String responeBody = WestarHttpUtil.postMethod(url,actCookie,postParam);
        try{
            JSONObject jsonObject = JSONObject.parseObject(responeBody);
            Integer total = jsonObject.getInteger("total");
            JSONArray jsonArray = jsonObject.getJSONArray("rows");

            ImplementPageUtil.addStringIntoList(jsonArray,list);

            if(total > 0){
                Integer totalPage = total/pageSize;
                if(total % pageSize > 0){
                    totalPage = totalPage + 1;
                }
                for(int index = 2; index <= totalPage; index ++ ){
                    postParam.put("page",index + "");
                    responeBody = WestarHttpUtil.postMethod(url,actCookie,postParam);
                    jsonObject = JSONObject.parseObject(responeBody);
                    jsonArray = jsonObject.getJSONArray("rows");
                    ImplementPageUtil.addStringIntoList(jsonArray,list);
                }

            }
        }catch (Exception e){
            logger.error( e.getMessage());
            throw new IOException(responeBody);

        }
        return list;
    }

    /**
     * 添加受理条件信息
     * @param jsonArray
     * @param list
     */
    private static void addStringIntoList(JSONArray jsonArray, List<String> list) {
        if(null != jsonArray && !jsonArray.isEmpty()){
            for (Object object :  jsonArray) {
                list.add(object.toString());
            }
        }
    }

    /**
     * 服务信息列表查看
     * @param actCookie
     * @param idForStr
     * @return
     * @throws IOException
     */
    public static List<String> listImplementBaseServiceInfo(String actCookie, String idForStr) throws IOException {
        String url = "http://"+SysConst.DOMAIN + "/thingsui/implementList/queryServiceInfoList";
        List<String> list = ImplementPageUtil.listImplementBaseInfo(actCookie,idForStr,url);
        return list;
    }

    /**
     * 审批结果样表信息
     * @param actCookie
     * @param idForStr
     * @return
     * @throws IOException
     */
    public static List<String> sampleFileList(String actCookie, String idForStr) throws IOException {
        List<String> list = new ArrayList<String>();

        Integer pageSize = 10;
        String url = "http://"+SysConst.DOMAIN + "/thingsui/dLSampleFile/listData";
        Map<String,String> postParam = new HashMap<>();
        postParam.put("implListId",idForStr);
        postParam.put("page","1");
        postParam.put("rows",pageSize.toString());
        postParam.put("_",System.currentTimeMillis()+"");

        String responeBody = WestarHttpUtil.getMethod(url,actCookie,postParam);

        JSONObject jsonObject = JSONObject.parseObject(responeBody);
        Integer total = jsonObject.getInteger("total");
        JSONArray jsonArray = jsonObject.getJSONArray("rows");
        if(total > 0){
            ImplementPageUtil.addStringIntoList(jsonArray,list);
            Integer totalPage = total / pageSize;
            if(total % pageSize > 0){
                totalPage = totalPage + 1;
            }
            for(int index = 2; index <= totalPage; index ++ ){
                postParam.put("page",index + "");
                responeBody = WestarHttpUtil.postMethod(url,actCookie,postParam);
                jsonObject = JSONObject.parseObject(responeBody);
                jsonArray = jsonObject.getJSONArray("rows");
                ImplementPageUtil.addStringIntoList(jsonArray,list);
            }
        }
        return list;
    }

    /**
     * 中介服务信息
     * @param actCookie
     * @param idForStr
     * @return
     * @throws IOException
     */
    public static List<String> agencyServiceList(String actCookie, String idForStr) throws IOException {
        String url = "http://"+SysConst.DOMAIN + "/thingsui/implementList/queryAgencyService";
        List<String> list = ImplementPageUtil.listImplementBaseInfo(actCookie,idForStr,url);
        return list;
    }

    /**
     * 法律依据
     * @param actCookie
     * @param idForStr
     * @return
     * @throws IOException
     */
    public static List<String> queryLawRegulations(String actCookie, String idForStr) throws IOException {
        String url = "http://"+SysConst.DOMAIN + "/thingsui/implementList/queryLawRegulations";
        List<String> list = ImplementPageUtil.listImplementBaseInfo(actCookie,idForStr,url);
        return list;
    }

    /**
     * 申请材料查看
     * @param actCookie
     * @param idForStr
     * @return
     * @throws IOException
     */
    public static List<String> queryMaterialListV2(String actCookie, String idForStr) throws IOException {
        String url = "http://"+SysConst.DOMAIN + "/thingsui/implementList/queryMaterialList";
        List<String> list = ImplementPageUtil.listImplementBaseInfo(actCookie,idForStr,url);
        return list;
    }

    /**
     * 常见问题信息
     * @param actCookie
     * @param idForStr
     * @return
     * @throws IOException
     */
    public static List<String> queryFaqList(String actCookie, String idForStr) throws IOException {
        String url = "http://"+SysConst.DOMAIN + "/thingsui/implementList/queryFaqList";
        List<String> list = ImplementPageUtil.listImplementBaseInfo(actCookie,idForStr,url);
        return list;
    }

    /**
     * 审查要点信息
     * @param actCookie
     * @param idForStr
     * @return
     * @throws IOException
     */
    public static List<String> queryReviewDetail(String actCookie, String idForStr) throws IOException {

        String url = "http://"+SysConst.DOMAIN + "/thingsui/implementList/queryReviewDetai";
        List<String> list = ImplementPageUtil.listImplementBaseInfo(actCookie,idForStr,url);
        return list;
    }

    /**
     * 自由裁量
     * @param actCookie
     * @param idForStr
     * @return
     */
    public static List<String> queryPunishListNoPage(String actCookie, String idForStr) throws IOException {

        String url = "http://"+SysConst.DOMAIN + "/thingsui/implementList/queryPunishListNoPage";
        List<String> list = ImplementPageUtil.listImplementBaseInfo(actCookie,idForStr,url);
        return list;
    }

    /**
     * 收费项目
     * @param actCookie
     * @param idForStr
     * @return
     * @throws IOException
     */
    public static List<String> queryChargeInfoList(String actCookie, String idForStr) throws IOException {
        String url = "http://"+SysConst.DOMAIN + "/thingsui/implementList/queryChargeInfoList";
        List<String> list = ImplementPageUtil.listImplementBaseInfo(actCookie,idForStr,url);
        return list;
    }

    public static WtaskGeneralBasic constrWtaskGeneralBasic(ImplementDetail implementDetail,String actCookie) throws IOException {
        String jsonStr = implementDetail.getSourceStr();
        //2、查询事项基本信息表
        WtaskGeneralBasic wtaskGeneralBasic = ImplementDetailUtil.getWtaskGeneralBasic(actCookie,jsonStr);

        try{
            //3、根据事项基本信息查询扩展表
            WtaskGeneralExtend wtaskGeneralExtend  =  ImplementDetailUtil.getWtaskGeneralExtend(actCookie,jsonStr);
            wtaskGeneralBasic.setWtaskGeneralExtend(wtaskGeneralExtend);

            //4、根据事项基本信息查询法律依据
            List<WtaskGeneralLaw> wtaskGeneralLawList = ImplementDetailUtil.getWtaskGeneralLaws(actCookie,jsonStr);
            wtaskGeneralBasic.setWtaskGeneralLawList(wtaskGeneralLawList);

            String isFee = wtaskGeneralBasic.getIsFee();
            if(null!= isFee && isFee.equals("1")){
                //5、根据事项基本信息查询收费项目信息
                List<WtaskGeneralFeeProject> wtaskGeneralFeeProjectList = ImplementDetailUtil.getWtaskGeneralFeeProject(actCookie,jsonStr);
                wtaskGeneralBasic.setWtaskGeneralFeeProjectList(wtaskGeneralFeeProjectList);
            }
            //6、根据事项基本信息查询情形材料分类
            List<WtaskGeneralMaterialcase> wtaskGeneralMaterialcaseList = ImplementDetailUtil.getWtaskGeneralMaterialcase(actCookie,jsonStr);
            wtaskGeneralBasic.setWtaskGeneralMaterialcaseList(wtaskGeneralMaterialcaseList);

            //7、根据事项基本信息查询常见问题解答
            List<WtaskGeneralQuestions> wtaskGeneralQuestionsList = ImplementDetailUtil.getWtaskGeneralQuestions(actCookie,jsonStr);
            wtaskGeneralBasic.setWtaskGeneralQuestionsList(wtaskGeneralQuestionsList);

            //8、根据事项基本信息查询材料信息
            List<WtaskGeneralMaterial> wtaskGeneralMaterialList = ImplementDetailUtil.getWtaskGeneralMaterial(actCookie,jsonStr);
            wtaskGeneralBasic.setWtaskGeneralMaterialList(wtaskGeneralMaterialList);

            //9.审查要点信息
            List<WtaskGeneralCheckTip> wtaskGeneralCheckTipList = ImplementDetailUtil.getWtaskGeneralCheckTip(actCookie,jsonStr);
            wtaskGeneralBasic.setWtaskGeneralCheckTipList(wtaskGeneralCheckTipList);

            //10.自由裁量
            List<WtaskGeneralDiscretion> wtaskGeneralDiscretionList = ImplementDetailUtil.getWtaskGeneralDiscretion(actCookie,jsonStr);
            wtaskGeneralBasic.setWtaskGeneralDiscretionList(wtaskGeneralDiscretionList);
        }catch ( IOException e){
        }

        return wtaskGeneralBasic;
    }
}
